<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
MathUtils (Commons Math 3.2 API)
</TITLE>


<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

<SCRIPT type="text/javascript">
function windowTitle()
{
    if (location.href.indexOf('is-external=true') == -1) {
        parent.document.title="MathUtils (Commons Math 3.2 API)";
    }
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>

</HEAD>

<BODY BGCOLOR="white" onload="windowTitle();">
<HR>


<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/MathUtils.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../../org/apache/commons/math3/util/MathArrays.OrderDirection.html" title="enum in org.apache.commons.math3.util"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../../org/apache/commons/math3/util/MultidimensionalCounter.html" title="class in org.apache.commons.math3.util"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../../index.html?org/apache/commons/math3/util/MathUtils.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="MathUtils.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>


</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->

<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.apache.commons.math3.util</FONT>
<BR>
Class MathUtils</H2>
<PRE>
<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A>
  <IMG SRC="../../../../../resources/inherit.gif" ALT="extended by "><B>org.apache.commons.math3.util.MathUtils</B>
</PRE>
<HR>
<DL>
<DT><PRE>public final class <B>MathUtils</B><DT>extends <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></DL>
</PRE>

<P>
Miscellaneous utility functions.
<P>

<P>
<DL>
<DT><B>Version:</B></DT>
  <DD>$Id: MathUtils.java 1416643 2012-12-03 19:37:14Z tn $</DD>
<DT><B>See Also:</B><DD><A HREF="../../../../../org/apache/commons/math3/util/ArithmeticUtils.html" title="class in org.apache.commons.math3.util"><CODE>ArithmeticUtils</CODE></A>, 
<A HREF="../../../../../org/apache/commons/math3/util/Precision.html" title="class in org.apache.commons.math3.util"><CODE>Precision</CODE></A>, 
<A HREF="../../../../../org/apache/commons/math3/util/MathArrays.html" title="class in org.apache.commons.math3.util"><CODE>MathArrays</CODE></A></DL>
<HR>

<P>
<!-- =========== FIELD SUMMARY =========== -->

<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Field Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/util/MathUtils.html#TWO_PI">TWO_PI</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2 &pi;.</TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->

<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/util/MathUtils.html#checkFinite(double)">checkFinite</A></B>(double&nbsp;x)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Check that the argument is a real number.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/util/MathUtils.html#checkFinite(double[])">checkFinite</A></B>(double[]&nbsp;val)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Check that all the elements are real numbers.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/util/MathUtils.html#checkNotNull(java.lang.Object)">checkNotNull</A></B>(<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A>&nbsp;o)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Checks that an object is not null.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/util/MathUtils.html#checkNotNull(java.lang.Object, org.apache.commons.math3.exception.util.Localizable, java.lang.Object...)">checkNotNull</A></B>(<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A>&nbsp;o,
             <A HREF="../../../../../org/apache/commons/math3/exception/util/Localizable.html" title="interface in org.apache.commons.math3.exception.util">Localizable</A>&nbsp;pattern,
             <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A>...&nbsp;args)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Checks that an object is not null.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/util/MathUtils.html#copySign(byte, byte)">copySign</A></B>(byte&nbsp;magnitude,
         byte&nbsp;sign)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the first argument with the sign of the second argument.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/util/MathUtils.html#copySign(int, int)">copySign</A></B>(int&nbsp;magnitude,
         int&nbsp;sign)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the first argument with the sign of the second argument.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;long</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/util/MathUtils.html#copySign(long, long)">copySign</A></B>(long&nbsp;magnitude,
         long&nbsp;sign)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the first argument with the sign of the second argument.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;short</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/util/MathUtils.html#copySign(short, short)">copySign</A></B>(short&nbsp;magnitude,
         short&nbsp;sign)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the first argument with the sign of the second argument.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/util/MathUtils.html#hash(double)">hash</A></B>(double&nbsp;value)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an integer hash code representing the given double value.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/util/MathUtils.html#hash(double[])">hash</A></B>(double[]&nbsp;value)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an integer hash code representing the given double array.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/util/MathUtils.html#normalizeAngle(double, double)">normalizeAngle</A></B>(double&nbsp;a,
               double&nbsp;center)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Normalize an angle in a 2&pi wide interval around a center value.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/util/MathUtils.html#reduce(double, double, double)">reduce</A></B>(double&nbsp;a,
       double&nbsp;period,
       double&nbsp;offset)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reduce <code>|a - offset|</code> to the primary interval
 <code>[0, |period|)</code>.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>

<!-- ============ FIELD DETAIL =========== -->

<A NAME="field_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Field Detail</B></FONT></TH>
</TR>
</TABLE>

<A NAME="TWO_PI"><!-- --></A><H3>
TWO_PI</H3>
<PRE>
public static final double <B>TWO_PI</B></PRE>
<DL>
<DD>2 &pi;.
<P>
<DL>
<DT><B>Since:</B></DT>
  <DD>2.1</DD>
<DT><B>See Also:</B><DD><A HREF="../../../../../constant-values.html#org.apache.commons.math3.util.MathUtils.TWO_PI">Constant Field Values</A></DL>
</DL>

<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>

<A NAME="hash(double)"><!-- --></A><H3>
hash</H3>
<PRE>
public static int <B>hash</B>(double&nbsp;value)</PRE>
<DL>
<DD>Returns an integer hash code representing the given double value.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>value</CODE> - the value to be hashed
<DT><B>Returns:</B><DD>the hash code</DL>
</DD>
</DL>
<HR>

<A NAME="hash(double[])"><!-- --></A><H3>
hash</H3>
<PRE>
public static int <B>hash</B>(double[]&nbsp;value)</PRE>
<DL>
<DD>Returns an integer hash code representing the given double array.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>value</CODE> - the value to be hashed (may be null)
<DT><B>Returns:</B><DD>the hash code<DT><B>Since:</B></DT>
  <DD>1.2</DD>
</DL>
</DD>
</DL>
<HR>

<A NAME="normalizeAngle(double, double)"><!-- --></A><H3>
normalizeAngle</H3>
<PRE>
public static double <B>normalizeAngle</B>(double&nbsp;a,
                                    double&nbsp;center)</PRE>
<DL>
<DD>Normalize an angle in a 2&pi wide interval around a center value.
 <p>This method has three main uses:</p>
 <ul>
   <li>normalize an angle between 0 and 2&pi;:<br/>
       <code>a = MathUtils.normalizeAngle(a, FastMath.PI);</code></li>
   <li>normalize an angle between -&pi; and +&pi;<br/>
       <code>a = MathUtils.normalizeAngle(a, 0.0);</code></li>
   <li>compute the angle between two defining angular positions:<br>
       <code>angle = MathUtils.normalizeAngle(end, start) - start;</code></li>
 </ul>
 <p>Note that due to numerical accuracy and since &pi; cannot be represented
 exactly, the result interval is <em>closed</em>, it cannot be half-closed
 as would be more satisfactory in a purely mathematical view.</p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>a</CODE> - angle to normalize<DD><CODE>center</CODE> - center of the desired 2&pi; interval for the result
<DT><B>Returns:</B><DD>a-2k&pi; with integer k and center-&pi; &lt;= a-2k&pi; &lt;= center+&pi;<DT><B>Since:</B></DT>
  <DD>1.2</DD>
</DL>
</DD>
</DL>
<HR>

<A NAME="reduce(double, double, double)"><!-- --></A><H3>
reduce</H3>
<PRE>
public static double <B>reduce</B>(double&nbsp;a,
                            double&nbsp;period,
                            double&nbsp;offset)</PRE>
<DL>
<DD><p>Reduce <code>|a - offset|</code> to the primary interval
 <code>[0, |period|)</code>.</p>

 <p>Specifically, the value returned is <br/>
 <code>a - |period| * floor((a - offset) / |period|) - offset</code>.</p>

 <p>If any of the parameters are <code>NaN</code> or infinite, the result is
 <code>NaN</code>.</p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>a</CODE> - Value to reduce.<DD><CODE>period</CODE> - Period.<DD><CODE>offset</CODE> - Value that will be mapped to <code>0</code>.
<DT><B>Returns:</B><DD>the value, within the interval <code>[0 |period|)</code>,
 that corresponds to <code>a</code>.</DL>
</DD>
</DL>
<HR>

<A NAME="copySign(byte, byte)"><!-- --></A><H3>
copySign</H3>
<PRE>
public static byte <B>copySign</B>(byte&nbsp;magnitude,
                            byte&nbsp;sign)
                     throws <A HREF="../../../../../org/apache/commons/math3/exception/MathArithmeticException.html" title="class in org.apache.commons.math3.exception">MathArithmeticException</A></PRE>
<DL>
<DD>Returns the first argument with the sign of the second argument.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>magnitude</CODE> - Magnitude of the returned value.<DD><CODE>sign</CODE> - Sign of the returned value.
<DT><B>Returns:</B><DD>a value with magnitude equal to <code>magnitude</code> and with the
 same sign as the <code>sign</code> argument.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/apache/commons/math3/exception/MathArithmeticException.html" title="class in org.apache.commons.math3.exception">MathArithmeticException</A></CODE> - if <code>magnitude == Byte.MIN_VALUE</code>
 and <code>sign &gt;= 0</code>.</DL>
</DD>
</DL>
<HR>

<A NAME="copySign(short, short)"><!-- --></A><H3>
copySign</H3>
<PRE>
public static short <B>copySign</B>(short&nbsp;magnitude,
                             short&nbsp;sign)
                      throws <A HREF="../../../../../org/apache/commons/math3/exception/MathArithmeticException.html" title="class in org.apache.commons.math3.exception">MathArithmeticException</A></PRE>
<DL>
<DD>Returns the first argument with the sign of the second argument.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>magnitude</CODE> - Magnitude of the returned value.<DD><CODE>sign</CODE> - Sign of the returned value.
<DT><B>Returns:</B><DD>a value with magnitude equal to <code>magnitude</code> and with the
 same sign as the <code>sign</code> argument.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/apache/commons/math3/exception/MathArithmeticException.html" title="class in org.apache.commons.math3.exception">MathArithmeticException</A></CODE> - if <code>magnitude == Short.MIN_VALUE</code>
 and <code>sign &gt;= 0</code>.</DL>
</DD>
</DL>
<HR>

<A NAME="copySign(int, int)"><!-- --></A><H3>
copySign</H3>
<PRE>
public static int <B>copySign</B>(int&nbsp;magnitude,
                           int&nbsp;sign)
                    throws <A HREF="../../../../../org/apache/commons/math3/exception/MathArithmeticException.html" title="class in org.apache.commons.math3.exception">MathArithmeticException</A></PRE>
<DL>
<DD>Returns the first argument with the sign of the second argument.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>magnitude</CODE> - Magnitude of the returned value.<DD><CODE>sign</CODE> - Sign of the returned value.
<DT><B>Returns:</B><DD>a value with magnitude equal to <code>magnitude</code> and with the
 same sign as the <code>sign</code> argument.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/apache/commons/math3/exception/MathArithmeticException.html" title="class in org.apache.commons.math3.exception">MathArithmeticException</A></CODE> - if <code>magnitude == Integer.MIN_VALUE</code>
 and <code>sign &gt;= 0</code>.</DL>
</DD>
</DL>
<HR>

<A NAME="copySign(long, long)"><!-- --></A><H3>
copySign</H3>
<PRE>
public static long <B>copySign</B>(long&nbsp;magnitude,
                            long&nbsp;sign)
                     throws <A HREF="../../../../../org/apache/commons/math3/exception/MathArithmeticException.html" title="class in org.apache.commons.math3.exception">MathArithmeticException</A></PRE>
<DL>
<DD>Returns the first argument with the sign of the second argument.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>magnitude</CODE> - Magnitude of the returned value.<DD><CODE>sign</CODE> - Sign of the returned value.
<DT><B>Returns:</B><DD>a value with magnitude equal to <code>magnitude</code> and with the
 same sign as the <code>sign</code> argument.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/apache/commons/math3/exception/MathArithmeticException.html" title="class in org.apache.commons.math3.exception">MathArithmeticException</A></CODE> - if <code>magnitude == Long.MIN_VALUE</code>
 and <code>sign &gt;= 0</code>.</DL>
</DD>
</DL>
<HR>

<A NAME="checkFinite(double)"><!-- --></A><H3>
checkFinite</H3>
<PRE>
public static void <B>checkFinite</B>(double&nbsp;x)
                        throws <A HREF="../../../../../org/apache/commons/math3/exception/NotFiniteNumberException.html" title="class in org.apache.commons.math3.exception">NotFiniteNumberException</A></PRE>
<DL>
<DD>Check that the argument is a real number.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>x</CODE> - Argument.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/apache/commons/math3/exception/NotFiniteNumberException.html" title="class in org.apache.commons.math3.exception">NotFiniteNumberException</A></CODE> - if <code>x</code> is not a
 finite real number.</DL>
</DD>
</DL>
<HR>

<A NAME="checkFinite(double[])"><!-- --></A><H3>
checkFinite</H3>
<PRE>
public static void <B>checkFinite</B>(double[]&nbsp;val)
                        throws <A HREF="../../../../../org/apache/commons/math3/exception/NotFiniteNumberException.html" title="class in org.apache.commons.math3.exception">NotFiniteNumberException</A></PRE>
<DL>
<DD>Check that all the elements are real numbers.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>val</CODE> - Arguments.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/apache/commons/math3/exception/NotFiniteNumberException.html" title="class in org.apache.commons.math3.exception">NotFiniteNumberException</A></CODE> - if any values of the array is not a
 finite real number.</DL>
</DD>
</DL>
<HR>

<A NAME="checkNotNull(java.lang.Object, org.apache.commons.math3.exception.util.Localizable, java.lang.Object...)"><!-- --></A><H3>
checkNotNull</H3>
<PRE>
public static void <B>checkNotNull</B>(<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A>&nbsp;o,
                                <A HREF="../../../../../org/apache/commons/math3/exception/util/Localizable.html" title="interface in org.apache.commons.math3.exception.util">Localizable</A>&nbsp;pattern,
                                <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A>...&nbsp;args)
                         throws <A HREF="../../../../../org/apache/commons/math3/exception/NullArgumentException.html" title="class in org.apache.commons.math3.exception">NullArgumentException</A></PRE>
<DL>
<DD>Checks that an object is not null.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>o</CODE> - Object to be checked.<DD><CODE>pattern</CODE> - Message pattern.<DD><CODE>args</CODE> - Arguments to replace the placeholders in <code>pattern</code>.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/apache/commons/math3/exception/NullArgumentException.html" title="class in org.apache.commons.math3.exception">NullArgumentException</A></CODE> - if <code>o</code> is <code>null</code>.</DL>
</DD>
</DL>
<HR>

<A NAME="checkNotNull(java.lang.Object)"><!-- --></A><H3>
checkNotNull</H3>
<PRE>
public static void <B>checkNotNull</B>(<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A>&nbsp;o)
                         throws <A HREF="../../../../../org/apache/commons/math3/exception/NullArgumentException.html" title="class in org.apache.commons.math3.exception">NullArgumentException</A></PRE>
<DL>
<DD>Checks that an object is not null.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>o</CODE> - Object to be checked.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/apache/commons/math3/exception/NullArgumentException.html" title="class in org.apache.commons.math3.exception">NullArgumentException</A></CODE> - if <code>o</code> is <code>null</code>.</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>


<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/MathUtils.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../../org/apache/commons/math3/util/MathArrays.OrderDirection.html" title="enum in org.apache.commons.math3.util"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../../org/apache/commons/math3/util/MultidimensionalCounter.html" title="class in org.apache.commons.math3.util"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../../index.html?org/apache/commons/math3/util/MathUtils.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="MathUtils.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>


</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->

<HR>
Copyright &#169; 2003-2013 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved.
</BODY>
</HTML>
